package com.woniu.shop.mapper;

import com.woniu.shop.pojo.ServiceEvaluate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 服务评价表 Mapper 接口
 * </p>
 *
 * @author malei
 * @since 2023-02-17
 */
public interface ServiceEvaluateMapper extends BaseMapper<ServiceEvaluate> {

    @Select("SELECT * FROM t_service_evaluate WHERE is_deleted = 0 and service_id=#{serviceId};")
    List<ServiceEvaluate> selectByServiceId(@Param("serviceId") String serviceId);

    @Select("SELECT * FROM t_service_evaluate where service_id = #{id} and evaluate_status = #{status}")
    List<ServiceEvaluate> queryServiceEvaluateById(@Param("id") String id,@Param("status") String status);

    @Update("UPDATE t_service_evaluate  set reply = #{message},evaluate_status = '1' WHERE id=#{id};")
    int replyEvaluate(@Param("id")String id, @Param("message")String message);

    @Select("SELECT * FROM t_service_evaluate where user_id = #{id} and evaluate_status = #{status}")
    List<ServiceEvaluate> queryByUserId(@Param("id")String id,@Param("status") String status);
}
